//
//  TableViewCell.m
//  YinYueBoFang_Forever
//
//  Created by lanou3g on 15/11/5.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "TableViewCell.h"
#import "DataHandle.h"
@implementation TableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self p_setupViews];
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
}
-(void)p_setupViews
{
    
    
    
    self.imv = [[UIImageView alloc] init];
//        self.imv.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.imv];
    
    
    self.lab1 = [[UILabel alloc] init];
//        self.lab1.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.lab1];
    
    self.lab2 = [[UILabel alloc] init];
//        self.lab2.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.lab2];
    
    
//    self.backImv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[[[DataHandle defaultDataHandle] musicModelWithindex:1] blurPicUrl]]];
//    self.backImv.frame = self.bounds;
//    [self addSubview:self.backImv];
//    
//    
//    [self.backImv addSubview:self.contentView];
    
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    self.imv.frame = CGRectMake(5, 5, CGRectGetWidth(self.contentView.frame)-300, CGRectGetHeight(self.contentView.frame)-10);
    
    
    self.lab1.frame = CGRectMake(CGRectGetMaxX(self.imv.frame)+10, 5, CGRectGetWidth(self.contentView.frame)-100, 20);
    
    
    self.lab2.frame = CGRectMake(CGRectGetMaxX(self.imv.frame)+10, CGRectGetHeight(self.contentView.frame)-25, CGRectGetWidth(self.contentView.frame)-100, 20);
}

-(void)bindModel:(MusicModel *)model
{
    self.lab1.text = model.name;
    self.lab2.text = model.singer;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
